//
//  HeartBeat.h
//  gdemm
//
//  Created by yongwu on 15/12/28.
//  Copyright © 2015年 goldensoft. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Utils.h"
#import "Constants.h"
#import <GCDAsyncUdpSocket.h>
#import <GCDAsyncSocket.h>
#import "HttpUtil.h"
#define PACKET_TYPE_HEARTBEAT  0
#define PACKET_TYPE_NOTIFY  1
#define PACKET_TYPE_ACTION  2    // 实时动作

#define NOTIFY_TYPE_FILESYNC  @"1"
#define NOTIFY_TYPE_POLICYUPDATE  @"2"
#define NOTIFY_TYPE_MESSAGE  @"3"

#define ACTION_TYPE_RING  1
#define ACTION_TYPE_EXAMINE  2
#define ACTION_TYPE_LOCATION  3
#define HEARTBEAT_PORT 30001
#define REDIS_PORT 30019
#define SOCKET_TIMEOUT 10
@protocol OnlineStateListener <NSObject>
@required
-(void)onLine:(BOOL)isOnLine;
@end
@interface HeartBeat : NSObject<GCDAsyncUdpSocketDelegate,GCDAsyncSocketDelegate>

+(instancetype) shareInstance ;
-(void)addOnlineStateListener:(id<OnlineStateListener>) listener;
+(BOOL)isOnline;
-(void)offline;
- (void)close;
-(void)sendRedis;
@end
